//------------Sonic CD Anton Script-------------//
//--------Scripted by Christian Whitehead 'The Taxman'--------//
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//

//-------Aliases-------//
#alias 36: TYPE_ANTON


sub ObjectMain
	if Object.PropertyValue==0
		Object.Frame+=2
		switch Object.State
		case 0
			Object.XPos-=65536
			Object.Value0--
			if Object.Value0==-128
				Object.State=1
				Object.Direction=FACING_LEFT
			endif
			ObjectTileGrip(0,0,20,0)
			if CheckResult==0
				Object.State=1
				Object.Value0=-128
				Object.Direction=FACING_LEFT
			endif
			break
		case 1
			Object.XPos+=65536
			Object.Value0++
			if Object.Value0==128
				Object.State=0
				Object.Direction=FACING_RIGHT
			endif
			ObjectTileGrip(0,0,20,0)
			if CheckResult==0
				Object.State=0
				Object.Value0=128
				Object.Direction=FACING_RIGHT
			endif
			break

		endswitch
	else
		Object.Frame++
		switch Object.State
		case 0
			Object.XPos-=32768
			Object.Value0--
			if Object.Value0==-256
				Object.State=1
				Object.Direction=FACING_LEFT
			endif
			ObjectTileGrip(0,0,20,0)
			if CheckResult==0
				Object.State=1
				Object.Value0=-256
				Object.Direction=FACING_LEFT
			endif
			break
		case 1
			Object.XPos+=32768
			Object.Value0++
			if Object.Value0==256
				Object.State=0
				Object.Direction=FACING_RIGHT
			endif
			ObjectTileGrip(0,0,20,0)
			if CheckResult==0
				Object.State=0
				Object.Value0=256
				Object.Direction=FACING_RIGHT
			endif
			break

		endswitch
	endif
	Object.Frame&=15
	CallFunction(StageSetup_CheckGoodFuture)
endsub


sub ObjectPlayerInteraction
	PlayerObjectCollision(C_TOUCH,-12,-18,12,20)
	if CheckResult==1
		CallFunction(PlayerObject_BadnikBreak)
	endif
endsub


sub ObjectDraw
	TempValue0=Object.Frame
	TempValue0>>=3
	if Object.PropertyValue==0
		TempValue0+=4
		DrawSpriteFX(TempValue0,FX_FLIP,Object.XPos,Object.YPos)
		TempValue0-=4
		DrawSpriteFX(TempValue0,FX_FLIP,Object.XPos,Object.YPos)
		TempValue0+=6
		DrawSpriteFX(TempValue0,FX_FLIP,Object.XPos,Object.YPos)
	else
		TempValue0+=4
		DrawSpriteFX(TempValue0,FX_FLIP,Object.XPos,Object.YPos)
		TempValue0-=2
		DrawSpriteFX(TempValue0,FX_FLIP,Object.XPos,Object.YPos)
		TempValue0+=4
		DrawSpriteFX(TempValue0,FX_FLIP,Object.XPos,Object.YPos)
	endif
endsub


sub ObjectStartup
	LoadSpriteSheet("R1/Objects.gif")
	SpriteFrame(-12,-19,24,32,1,1)
	SpriteFrame(-12,-20,24,32,1,1)
	SpriteFrame(-12,-19,24,32,26,1)
	SpriteFrame(-12,-20,24,32,26,1)
	SpriteFrame(-8,4,16,16,1,34)
	SpriteFrame(-8,4,16,16,18,34)
	SpriteFrame(14,-4,8,8,35,34)
	SpriteFrame(18,-5,8,8,35,34)
endsub

sub RSDK
	LoadSpriteSheet("Global/Display.gif")
	SetEditorIcon(Icon0,SingleIcon,-16,-16,32,32,1,143)
endsub
